function main() {

    var library_name = "libMyGame.so" // ex: libsqlite.so
    var loaded = false
    Interceptor.attach(Module.findExportByName(null, 'android_dlopen_ext'),{
        onEnter: function(args){
            var library_path = Memory.readCString(args[0])
            // console.log("found library : " + library_path)
            if( library_path.includes(library_name)){
                console.log("found library : " + library_path)
                loaded = true
            }
        },
        onLeave: function(args){
            if(loaded){
             
       
          
                {
                    var libnative_addr = Module.findBaseAddress(library_name)
                    console.log("libnative_addr is: " + libnative_addr)
                    var addr = Module.findExportByName(library_name ,"_ZN10PopUpLayer14buttonCallBackEPN7cocos2d4NodeE")
                    console.log("buttonCallBack:"+addr)
                        Interceptor.attach(ptr(addr) , {
                        onEnter: function(args){
                            console.log("_ZN10PopUpLayer14buttonCallBackEPN7cocos2d4NodeE")
                            console.log('called from:\n' +
                            Thread.backtrace(this.context, Backtracer.ACCURATE)
                            .map(DebugSymbol.fromAddress).join('\n') + '\n');
                        },
                        onLeave: function(retval){
                            }
                        })
                }
              
                
                {
                    var addr = Module.findExportByName(library_name ,"_ZN10PopUpLayer6createEib")
                    console.log("addr:"+addr)
                        Interceptor.attach(ptr(addr) , {
                        onEnter: function(args){
                            console.log("_ZN10PopUpLayer6createEib")
                            console.log('called from:\n' +
                            Thread.backtrace(this.context, Backtracer.ACCURATE)
                            .map(DebugSymbol.fromAddress).join('\n') + '\n');
                        },
                        onLeave: function(retval){
                        }
                        })
                }


                {
                    var addr = Module.findExportByName(library_name ,"_ZN10PopUpLayer6createESs")
                    console.log("addr:"+addr)
                        Interceptor.attach(ptr(addr) , {
                        onEnter: function(args){
                            console.log("_ZN10PopUpLayer6createESs")
                            console.log('called from:\n' +

                            Thread.backtrace(this.context, Backtracer.ACCURATE)
                    
                            .map(DebugSymbol.fromAddress).join('\n') + '\n');
                        },
                        onLeave: function(retval){
                        }
                        })
                }               
            
             


                loaded = false
            }
        }
    })
}
setImmediate(main);

// frida -U --no-pause -f com.hnzh.dldlwhjx.aligames -l c2ddldl
// frida -U --no-pause -f com.chucker.shaonianxiakexing2 -l c2dbx



